//import * as echarts from 'echarts';
window.onload = function(){
		function int(){
			var size=$('body').width()*0.15625;
			var width=$('html').css('font-size',size+'px');	
			var lev=document.body.clientWidth/document.body.clientHeight;  //
					console.log(lev);
			if(lev<0.54){$('#main').css({'width':'300px'});$('.logo').css({'padding':'20px'});$('.table td').css({'padding':'7px 0'});$('.foot').css({'padding-bottom':'20px'})}
		};
		int();	//rem，px
	};	
	//预加载
	var loadingimage = new Image();
    loadingimage.src="images/load.gif" ;
	var stitle = '榜单';
    loadingimage.onload=function() {
	//	$('#search').css({'width':$('body').width()*0.9-70})
		$('#search').css({'width':$('body').width()*0.9})
        resizenew();	 //图片下载完毕时异步调用resizenew()函数。	
    };
	var flag1=flag2=flag3=false;
	var html1=html2=html3='';
	var arr2=arr3=[{'name':'上海'},{'zhishu':['0.631712162637602','0.586152629616017','0.564708286345684','0.482390115796698','0.578638481667182','0.73004370575272']},{'qgrank':['3','4','2','3','3','2']},{'qsrank':['—','—','—','—','—','—']},{'province':'上海'},{'state':'新一线城市，省会城市'},{'all':['0.595812934911893','3','—']},{'GDP':['38700.58','1']}],
 arr1=[{'name':'北京'},{'zhishu':['0.893207468370513','0.797655414917937','0.772807966388503','0.927272727272727','0.441529065316068','0.774227419982513']},{'qgrank':['1','1','1','1','9','1']},{'qsrank':['—','—','—','—','—','—']},{'province':'北京'},{'state':'一线城市，直辖市'},{'all':['0.777539391474061','1','—']},{'GDP':['38700.58','1']}];
    $(function(){
        var imgList = ['img/icon1.png','img/icon2.png','img/icon3.png','img/icon4.png','img/icon5.png','img/icon6.png','img/icon5-1.png','img/icon6-1.png','img/logo.png','img/pk.png','img/icon7.png','img/icon8.png','img/pk.png','img/search.png','img/tu.png','img/share.png','img/btn2.png','img/btn3.png',];
        var imgNum = wid = 0;
       $.imgpreload(imgList,{
		 each: function () {
			  /*this will be called after each image loaded*/
			  var status = $(this).data('loaded') ? 'success' : 'error';
			  if (status == "success") {  
				  var v = (parseFloat(++imgNum) / imgList.length).toFixed(2);
				  $(".popload-main-txt").html(Math.round(v * 100) + "<sup>%</sup>"); 
                  $('.popload-main-txt1 span').css('width',Math.round(v * 100)+'%');
                  console.log(Math.round(v * 100))				  
			  }
		},
		all: function () {
			  /*this will be called after all images loaded*/
				$(".popload-main-txt").html("100<sup>%</sup>");
				setTimeout(function(){loadingf();$('.page-0').addClass('showP')},400);
				$('.table1').html(`<tr class="headt"><td>&nbsp;</td><td style="width:18%;">得分</td><td style="width:20%;">排名</td></tr>
				<tr><td>总得分</td><td>${Number(arr3[6].all[0]).toFixed(2)}</td><td>${arr3[6].all[1]}</td></tr>
				<tr><td>数字基础设施支撑力</td><td>${Number(arr3[1].zhishu[0]).toFixed(2)}</td><td>${arr3[2].qgrank[0]}</td></tr>
				<tr><td>数字产业化竞争力</td><td>${Number(arr3[1].zhishu[1]).toFixed(2)}</td><td>${arr3[2].qgrank[1]}</td></tr>
				<tr><td>产业数字化融合力</td><td>${Number(arr3[1].zhishu[2]).toFixed(2)}</td><td>${arr3[2].qgrank[2]}</td></tr>
				<tr><td>数字业态创新力</td><td>${Number(arr3[1].zhishu[3]).toFixed(2)}</td><td>${arr3[2].qgrank[3]}</td></tr>
				<tr><td>数字业态创新力</td><td>${Number(arr3[1].zhishu[4]).toFixed(2)}</td><td>${arr3[2].qgrank[4]}</td></tr>
				<tr><td>数字要素创新活力</td><td>${Number(arr3[1].zhishu[5]).toFixed(2)}</td><td>${arr3[2].qgrank[5]}</td></tr>`);
				$('.table2').html(`<tr class="headt"><td style="width:10%;">排名</td><td style="width:13%;">得分</td><td style="width:36%;">&nbsp;</td><td style="width:13%;">得分</td><td style="width:10%;">排名</td></tr>
				<tr><td>${arr1[6].all[1]}</td><td>${Number(arr1[6].all[0]).toFixed(2)}</td><td>总得分</td><td>${Number(arr2[6].all[0]).toFixed(2)}</td><td>${arr2[6].all[1]}</td></tr>
				<tr><td>${arr1[2].qgrank[0]}</td><td>${Number(arr1[1].zhishu[0]).toFixed(2)}</td><td>数字基础设施支撑力</td><td>${Number(arr2[1].zhishu[0]).toFixed(2)}</td><td>${arr2[2].qgrank[0]}</td></tr>
				<tr><td>${arr1[2].qgrank[1]}</td><td>${Number(arr1[1].zhishu[1]).toFixed(2)}</td><td>数字产业化竞争力</td><td>${Number(arr2[1].zhishu[1]).toFixed(2)}</td><td>${arr2[2].qgrank[1]}</td></tr>
				<tr><td>${arr1[2].qgrank[2]}</td><td>${Number(arr1[1].zhishu[2]).toFixed(2)}</td><td>产业数字化融合力</td><td>${Number(arr2[1].zhishu[2]).toFixed(2)}</td><td>${arr2[2].qgrank[2]}</td></tr>
				<tr><td>${arr1[2].qgrank[3]}</td><td>${Number(arr1[1].zhishu[3]).toFixed(2)}</td><td>数字业态创新力</td><td>${Number(arr2[1].zhishu[3]).toFixed(2)}</td><td>${arr2[2].qgrank[3]}</td></tr>
				<tr><td>${arr1[2].qgrank[4]}</td><td>${Number(arr1[1].zhishu[4]).toFixed(2)}</td><td>数字业态创新力</td><td>${Number(arr2[1].zhishu[4]).toFixed(2)}</td><td>${arr2[2].qgrank[4]}</td></tr>
				<tr><td>${arr1[2].qgrank[5]}</td><td>${Number(arr1[1].zhishu[5]).toFixed(2)}</td><td>数字要素创新活力</td><td>${Number(arr2[1].zhishu[5]).toFixed(2)}</td><td>${arr2[2].qgrank[5]}</td></tr>`);
			}
		});
    });
    function loadingf(){
		 setTimeout(function(){
            $('#loading').addClass('hide');
        },300);
    };
	function resizenew(){
		console.log('图片加载完成后，我开始加载内容了');
	};
	$('.icon_container').on('touchend',function(e){
        e.preventDefault();$('.pop').hide();
    });
    $('.btn5').on('touchend',function(e){//选择城市
        e.preventDefault();$('.pop').show();
		flag1=true;flag2=flag3=false;
    });
    $('.btn6').on('touchend',function(e){//选择城市
        e.preventDefault();$('.pop').show();
		flag2=true;flag1=flag3=false;
    });
    $('.btn8').on('touchend',function(e){//选择城市
        e.preventDefault();$('.pop').show();
		flag3=true;flag1=flag2=false;
    });
    $('.icon').click(function(){
		$('.pages').removeClass('showP');
		$('.icon').removeClass('hover');
		$('.list').removeClass('hov'); 
		$('.pages').eq($(this).data('id')).addClass('showP');
		$(this).addClass('hover');
	});
	$('#search').bind("input propertychange", function () {
	    var html = '';
	     var v = $(this).val(); //转大写字母
	    if (v.length < 1) {
	        $('#search_data').hide();
	        $('#search_data > ul').html('');
	        return;
	    }
	    for (var i in defaultDataSource) {
			var data_all=defaultDataSource[i];
			for (var j = 0; j < data_all.dataList.length; j++) {
				 const data = data_all.dataList[j];
				if (data.value.indexOf(v) >= 0 || data.value.toLowerCase( ).indexOf(v) >= 0) {
					html += '<li data-id="' + j + '">' + data.label + '</li>';
				}
			}
	    }
	    $('#search_data').show();
	    $('#search_data > ul').html(html);
	});
	
	$('#search_data > ul ').on("click", 'li', function () {
	    var data = $(this).html(); //获取data的值
		if(flag1==true){
			$('.log span,.btn5').html(data);
			for(var i=0; i<data_s.length;i++){
				if(data_s[i][0].name == data){
					arr1=data_s[i];
					data1=data_s[i][1].zhishu;console.log(data1);
				}
			}
		}else if(flag2==true){
			$('.log label,.btn6').html(data);
			for(var i=0; i<data_s.length;i++){
				if(data_s[i][0].name == data){
					arr2=data_s[i];
					data2=data_s[i][1].zhishu;console.log(data2);
				}
			}
		}else if(flag3==true){
		   $('.log font,.btn8 span').html(data);
		   html3='';
		   for(var i=0; i<data_s.length;i++){
		   	if(data_s[i][0].name == data){
		   		data3=data_s[i][1].zhishu;console.log(data3,data_s[i][1].zhishu);
				arr3=data_s[i];
		   	}
		   }
	   };
	   console.log(data1+'--'+data2+'--'+data3)
		$('#search').val("");
	    $('.pop,#search_data').hide();
	});
	//选择城市
	new indexSelection(null,function(data){
	   if(flag1==true){
	   	$('.log span,.btn5').html(data);
	   	for(var i=0; i<data_s.length;i++){
	   		if(data_s[i][0].name == data){
	   			arr1=data_s[i];
	   			data1=data_s[i][1].zhishu
	   		}
	   	}
	   }else if(flag2==true){
	   	$('.log label,.btn6').html(data);
	   	for(var i=0; i<data_s.length;i++){
	   		if(data_s[i][0].name == data){
	   			arr2=data_s[i];
	   			data2=data_s[i][1].zhishu;
	   		}
	   	}
	   }else if(flag3==true){
		$('.log font,.btn8 span').html(data);
		  html3='';
		  for(var i=0; i<data_s.length;i++){
		  	if(data_s[i][0].name == data){
		  		data3=data_s[i][1].zhishu
		  				arr3=data_s[i];
		  	}
		  }
	   };
	   console.log(data1+'--'+data2+'--'+data3)
	   $('.search').val("");
	    $('.pop,#search_data').hide();
	 });	
	$('.tebels div').click(function(){
		var data = $(this).html(); //获取data的值
		if(flag1==true){
			$('.log span,.btn5').html(data);
			for(var i=0; i<data_s.length;i++){
				if(data_s[i][0].name == data){
					arr1=data_s[i];
					data1=data_s[i][1].zhishu
				}
			}
		}else if(flag2==true){
			$('.log label,.btn6').html(data);
			for(var i=0; i<data_s.length;i++){
				if(data_s[i][0].name == data){
					arr2=data_s[i];
					data2=data_s[i][1].zhishu;
				}
			}
		}else if(flag3==true){
			$('.log font,.btn8 span').html(data);
			html3='';
			for(var i=0; i<data_s.length;i++){
				if(data_s[i][0].name == data){
					data3=data_s[i][1].zhishu;
							arr3=data_s[i];
				}
			}
	   };
		$('.search').val("");
		$('.pop,#search_data').hide();
	});
	$('.btn7').click(function(){ //arr1.arr2
		html1='';
		$('.l_group span,.btn5,.call label').html($('.log span').html());
		$('.r_group span,.btn6,.call font').html($('.log label').html());
		html1+='<tr class="headt"><td style="width:10%;">排名</td><td style="width:13%;">得分</td><td style="width:36%;">&nbsp;</td><td style="width:13%;">得分</td><td style="width:10%;">排名</td></tr>'+
				'<tr><td>'+arr1[6].all[1]+'</td><td>'+Number(arr1[6].all[0]).toFixed(2)+'</td><td>榜单</td><td>'+Number(arr2[6].all[0]).toFixed(2)+'</td><td>'+arr2[6].all[1]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[0]+'</td><td>'+Number(arr1[1].zhishu[0]).toFixed(2)+'</td><td>数字基础设施支撑力</td><td>'+Number(arr2[1].zhishu[0]).toFixed(2)+'</td><td>'+arr2[2].qgrank[0]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[1]+'</td><td>'+Number(arr1[1].zhishu[1]).toFixed(2)+'</td><td>数字产业化竞争力</td><td>'+Number(arr2[1].zhishu[1]).toFixed(2)+'</td><td>'+arr2[2].qgrank[1]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[2]+'</td><td>'+Number(arr1[1].zhishu[2]).toFixed(2)+'</td><td>产业数字化融合力</td><td>'+Number(arr2[1].zhishu[2]).toFixed(2)+'</td><td>'+arr2[2].qgrank[2]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[3]+'</td><td>'+Number(arr1[1].zhishu[3]).toFixed(2)+'</td><td>数字业态创新力</td><td>'+Number(arr2[1].zhishu[3]).toFixed(2)+'</td><td>'+arr2[2].qgrank[3]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[4]+'</td><td>'+Number(arr1[1].zhishu[4]).toFixed(2)+'</td><td>数字治理渗透力</td><td>'+Number(arr2[1].zhishu[4]).toFixed(2)+'</td><td>'+arr2[2].qgrank[4]+'</td></tr>'+
				'<tr><td>'+arr1[2].qgrank[5]+'</td><td>'+Number(arr1[1].zhishu[5]).toFixed(2)+'</td><td>数字要素创新活力</td><td>'+Number(arr2[1].zhishu[5]).toFixed(2)+'</td><td>'+arr2[2].qgrank[5]+'</td></tr>';
		$('.table2').html(html1);
		radarpk(data1,data2);
	});
	$('.btn81').on('touchend',function(e){//选择城市
        //e.preventDefault();
		e.stopPropagation();
		html3='';
		html3+='<tr class="headt"><td>&nbsp;</td><td style="width:18%;">得分</td><td style="width:20%;">排名</td></tr>'+
		 		'<tr><td>榜单</td><td>'+Number(arr3[6].all[0]).toFixed(2)+'</td><td>'+arr3[6].all[1]+'</td></tr>'+
		 		'<tr><td>数字基础设施支撑力</td><td>'+Number(arr3[1].zhishu[0]).toFixed(2)+'</td><td>'+arr3[2].qgrank[0]+'</td></tr>'+
		 		'<tr><td>数字产业化竞争力</td><td>'+Number(arr3[1].zhishu[1]).toFixed(2)+'</td><td>'+arr3[2].qgrank[1]+'</td></tr>'+
		 		'<tr><td>产业数字化融合力</td><td>'+Number(arr3[1].zhishu[2]).toFixed(2)+'</td><td>'+arr3[2].qgrank[2]+'</td></tr>'+
		 		'<tr><td>数字业态创新力</td><td>'+Number(arr3[1].zhishu[3]).toFixed(2)+'</td><td>'+arr3[2].qgrank[3]+'</td></tr>'+
		 		'<tr><td>数字治理渗透力</td><td>'+Number(arr3[1].zhishu[4]).toFixed(2)+'</td><td>'+arr3[2].qgrank[4]+'</td></tr>'+
		 		'<tr><td>数字要素创新活力</td><td>'+Number(arr3[1].zhishu[5]).toFixed(2)+'</td><td>'+arr3[2].qgrank[5]+'</td></tr>';
		$('.biaoge1 font').html(arr3[5].state);
		radarchart(data3);
		$('.table1').html(html3);
		$('.btn8 span,.call span,.biaoge1 label').html($('.log font').html());
	});
	$('#submit').click(function () {
	    $("#search").val("");
	    $(' #search_data').hide();
	})
	// 生成分享图片
	// $('.shareBtn').on('click',function(){
	// 	html2canvas(document.getElementById("share"), {
	// 	    useCORS: true,
	// 		dpi: window.devicePixelRatio * 2,
	// 	    scale: 2,
	// 	    logging:false,
	// 	}).then(function(canvas) {   //返回图片dataURL，参数：图片格式和清晰度(0-1) 
	// 	    var base = canvas.toDataURL('image/jpeg',1.0);
	// 	    $('#p3_img').attr('src', base);
	// 	    $('#p3').show();
	// 	});
	// });
		
// 生成分享图片
function creatShareImg() {
	$('.code,.call').show();
	$('.btn8,.shareBtn,.iconsm').hide();
  html2canvas($('#share')[0], {
    scale: 2,
    useCORS: true,
    // allowTaint: false,
    logging: false
  }).then(function (canvas) {
    var base64_img = canvas.toDataURL('image/png')
    // console.log(base64_img)
    // 页面弹窗显示生成的图片
    var shareImgHtml = '<div id="shareImg">' + '<div class="share_bg" onclick="closeShare()"></div>' + '<div class="img"><img src="' + base64_img + '" width="100%" id="sharePhoto" crossOrigin="Anonymous" /><a href="javascript:;" class="btn-close" onclick="closeShare()"></a></div>' + '</div>'
    // APP内打开，触发base64图片方法
      $('body').append(shareImgHtml);
  })
}
// 生成分享图片
function creatShareImg1() {
	$('.code,.call').show();
	$('.btn7,.city,.shareBtn1,.iconsm').hide();
  html2canvas($('#share1')[0], {
    scale: 2,
    useCORS: true,
    // allowTaint: false,
    logging: false
  }).then(function (canvas) {
    var base64_img = canvas.toDataURL('image/png')
    // console.log(base64_img)
    // 页面弹窗显示生成的图片
    var shareImgHtml = '<div id="shareImg">' + '<div class="share_bg" onclick="closeShare()"></div>' + '<div class="img"><img src="' + base64_img + '" width="100%" id="sharePhoto" crossOrigin="Anonymous" /><a href="javascript:;" class="btn-close" onclick="closeShare()"></a></div>' + '</div>'
    // APP内打开，触发base64图片方法
      $('body').append(shareImgHtml);
  })
}
$('.iconsm').on('click',function(){
	var aa = `<div id="shareImg"><div class="share_bg" onclick="closeShare()"></div><div class="img"><img src="img/sm.png" style="height: auto;padding-top: 60px;width:100%;" /><a href="javascript:;" class="btn-close" onclick="closeShare()"></a></div></div>`;
	$('body').append(aa);
})

// 关闭生成图
function closeShare() {
  $('#shareImg').remove();$('.code,.call').hide();
	$('.btn8,.btn7,.city,.shareBtn,.shareBtn1,.iconsm').show();
}
	

	//指数排序 排名，指数，省份 '网络热度','城市活力','产业发展','潮生活','印象'
	function screen(index){
		var array1=[];
		for(var i=0; i<data_s.length;i++){
			var obj = {};  //  一定要在循环体内部创建空对象，每循环一次就创建一个 如果在外部申请对象，得到的永远只有一个
			obj.qgrank = data_s[i][2].qgrank[index];
			obj.name = data_s[i][0].name;
			obj.province = data_s[i][4].province;
			obj.zhishu = data_s[i][1].zhishu[index];
			obj.zhishuname = data_s[i][8].zhishuname[index];
			array1.push(obj)	
		}
		return array1;
	//console.log(array1);  // 想要的数据格式 指数1
	}
	function compare(property){
		return function(a,b){
			var value1 = a[property];
			var value2 = b[property];
			return value1 - value2;
		} 
	};
	$('.list').on('click',function(e){//查看指数
		//$('.list').removeClass('hov');
		$(this).toggleClass('hov');
	});
	
	console.log(data_s)
	var listHtml1='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:25%;">省份</td><td style="width:28%;">总得分</td></tr>';
	for(var i=0; i<24;i++){
		listHtml1+='<tr><td>'+data_s[i][6].all[1]+'</td><td>'+data_s[i][0].name+'</td><td>'+data_s[i][4].province+'</td><td>'+Number(data_s[i][6].all[0]).toFixed(2)+'</td></tr>'
	}
	$('.table3').html(listHtml1);
	var dataf=screen(0);
	var dataf1=screen(1);
	var dataf2=screen(2);
	var dataf3=screen(3);
	var dataf4=screen(4);
	var dataf5=screen(5);
	var array2=dataf.sort(compare('qgrank'));
	var array3=dataf1.sort(compare('qgrank'));
	var array4=dataf2.sort(compare('qgrank'));
	var array5=dataf3.sort(compare('qgrank'));
	var array6=dataf4.sort(compare('qgrank'));
	var array7=dataf5.sort(compare('qgrank'));
	var listHtml2='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">数字基础设施支撑力</td></tr>';
	var listHtml3='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">数字产业化竞争力</td></tr>';
	var listHtml4='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">产业数字化融合力</td></tr>';
	var listHtml5='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">数字业态创新力</td></tr>';
	var listHtml6='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">数字治理渗透力</td></tr>';
	var listHtml7='<tr class="headt"><td style="width:22%;">排名</td><td style="width:25%;">城市</td><td style="width:53%;">数字要素创新活力</td></tr>';
	for(var key=0;key<24;key++){//console.log(array2[key]);
		listHtml2+='<tr><td>'+array2[key].qgrank+'</td><td>'+array2[key].name+'</td><td>'+Number(array2[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table4').html(listHtml2);
	for(var key=0;key<24;key++){
		listHtml3+='<tr><td>'+array3[key].qgrank+'</td><td>'+array3[key].name+'</td><td>'+Number(array3[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table5').html(listHtml3);
	for(var key=0;key<24;key++){
		listHtml4+='<tr><td>'+array4[key].qgrank+'</td><td>'+array4[key].name+'</td><td>'+Number(array4[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table6').html(listHtml4);
	for(var key=0;key<24;key++){
		listHtml5+='<tr><td>'+array5[key].qgrank+'</td><td>'+array5[key].name+'</td><td>'+Number(array5[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table7').html(listHtml5);
	for(var key=0;key<24;key++){
		listHtml6+='<tr><td>'+array6[key].qgrank+'</td><td>'+array6[key].name+'</td><td>'+Number(array6[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table8').html(listHtml6);
	for(var key=0;key<24;key++){
		listHtml7+='<tr><td>'+array7[key].qgrank+'</td><td>'+array7[key].name+'</td><td>'+Number(array7[key].zhishu).toFixed(2)+'</td></tr>'
	}
	$('.table9').html(listHtml7);
//	var dataf = [{name:'Zacharty',age: 31},{name:'Nicholas',age: 29},{name:'Nicholas',age: 30}];
// 这里根据数组对象中的age属性排序
//	console.log(dataf.sort(compare('age')));
// [{name:'Nicholas',age: 29},{name:'Nicholas',age: 30},{name:'Zacharty',age: 31}]
	





var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
function radarpk(data1,data2){
	console.log(data1)
	console.log(data2)
	let datax = [],datay = [];
	for(let i in data1){
		datax.push(Number(data1[i])*100);
	}
	for(let i in data2){
		datay.push(Number(data2[i])*100);
	}
	console.log(datax)
	console.log(datay)
var option = {
  color: ['#77dffd', '#d4a1fa'],
  legend: {
    data: ['上海', '北京'],
	right:'-100%'
  },
  radar: {
    indicator: [
      { name: '数字基础设施支撑力', max: 100 },
      { name: '数字产业化竞争力', max: 100 },
      { name: '产业数字化融合力', max: 100 },
      { name: '数字业态创新力', max: 100 },
      { name: '数字治理渗透力', max: 100 },
      { name: '数字要素创新活力', max: 100 },
    ],
	center: ['50%', '50%'],
    shape: 'circle',
	radius:65,
    splitArea: {
      areaStyle: {
        color: '#fff',
		lineHeight:'1.6'
        // shadowColor: 'rgba(0, 0, 0, 0.2)',
        // shadowBlur: 10
      }
    },
    splitLine: {
      lineStyle: {
        type: 'dashed',
        color: '#9a9a9a'
      }
    },
    name: {
      color: '#07238c'
    }
  },
  series: [
    {
      name: '上海',
      type: 'radar',
      data: [
        {
         // value: [90, 30, 20, 35, 50],
          value: datax,
          name: 'Allocated Budget',
          areaStyle: {
            color: '#77dffd'
          },
          lineStyle: {
            type: 'dashed',
            color: 'rgba(0,0,0,0)'
          }
        },
        {
          //value: [50, 80, 26, 42, 90],
		  value: datay,
          name: '北京',
          areaStyle: {
            color: '#d4a1fa'
          },
          lineStyle: {
            type: 'dotted',
            color: 'rgba(0,0,0,0)'
          }
        }
      ]
    }
  ]
};
option && myChart.setOption(option);
}
var data1=['0.893207468370513','0.797655414917937','0.772807966388503','0.927272727272727','0.441529065316068','0.774227419982513'],data2=['0.631712162637602','0.586152629616017','0.564708286345684','0.482390115796698','0.578638481667182','0.73004370575272'];
radarpk(data1,data2);

var chartDom1 = document.getElementById('main1');
var myChart1 = echarts.init(chartDom1);
function radarchart(datas){

	let datax = [];
	for(let i in datas){
		datax.push(Number(datas[i])*100);
	}
	var option = {
	color: ['#77dffd'],
	legend: {
		data: [ '北京'],
		right:'-100%'
	},
	radar: {
		indicator: [
			{ name: '数字基础设施支撑力', max: 100 },
			{ name: '数字产业化竞争力', max: 100 },
			{ name: '产业数字化融合力', max: 100 },
			{ name: '数字业态创新力', max: 100 },
			{ name: '数字治理渗透力', max: 100 },
			{ name: '数字要素创新活力', max: 100 },
		],
		center: ['50%', '50%'],
		shape: 'circle',
		radius:65,
		splitArea: {
		areaStyle: {
			color: '#fff',
			lineHeight:'1.6'
			// shadowColor: 'rgba(0, 0, 0, 0.2)',
			// shadowBlur: 10
		}
		},
		splitLine: {
		lineStyle: {
			type: 'dashed',
			color: '#9a9a9a'
		}
		},
		name: {
		color: '#07238c'
		}
	},
	series: [
		{
		name: '北京',
		type: 'radar',
		data: [
			{
			//value: [50, 80, 26, 42, 90],
			value: datax,
			name: '北京',
			areaStyle: {
				color: '#77dffd'
			},
			lineStyle: {
				type: 'dotted',
				color: 'rgba(0,0,0,0)'
			}
			}
		]
		}
	]
	};
	option && myChart1.setOption(option);
}
var data3=['0.631712162637602','0.586152629616017','0.564708286345684','0.482390115796698','0.578638481667182','0.73004370575272'];
radarchart(data3);